'This is the delay, in seconds, that we want to delay on
dim shared delay as single
'This is the time we started the delay
dim shared oldtime as double

sub InitDelay (del as single)
	
	'assign delay passed to module-specific variable
	delay=del
	
	'assign oldtimer
	oldtime=timer
	
end sub

sub WaitDelay ()

	'start delaying
	while (timer-oldtime) < delay
	wend
	
end sub

''how to use:
''InitDelay(delaytime) <---this does not delay yet
''
''do stuffs
''
''
''WaitDelay() <--- THIS delays until the time specified above elapses (remember that it was counting down
''                 after InitDelay was called)